set(CDLauncher_INCLUDE_DIRECTORIES
    "${WEBKIT_DIR}/cdroid"
    "${WEBCORE_DIR}"
    "${WEBCORE_DIR}/platform"
    "${WEBCORE_DIR}/platform/graphics"
    "${WEBCORE_DIR}/platform/network"
    "${WEBCORE_DIR}/platform/text"
    "${JAVASCRIPTCORE_DIR}"
    "${CAIRO_INCLUDE_DIRS}"
    "${FREETYPE2_INCLUDE_DIRS}"
    "${HARFBUZZ_INCLUDE_DIRS}"
    "${DERIVED_SOURCES_JAVASCRIPTCORE_DIR}"
    "${WTF_DIR}"
    "${DERIVED_SOURCES_DIR}"
    "${CMAKE_BINARY_DIR}"
    "${CDROID_INCLUDE_DIRS}"
)

set(CDLauncher_SOURCES
	${TOOLS_DIR}/CDLauncher/main.cpp
)
find_package(ZLIB)
find_package(Pixman)
find_package(LZMA)
find_package(ZIP)
find_package(EXPAT)

set(CDLauncher_LIBRARIES
    WTF JavaScriptCore WebCore WebKit 
    ${CURL_LIBRARIES} 
    ${OPENSSL_LIBRARIES} 
    ${CDROID_LIBRARIES}
    ${FREETYPE_LIBRARIES}
    ${FONTCONFIG_LIBRARIES}
    ${PNG_LIBRARIES}
    ${JPEG_LIBRARIES}
    ${HARFBUZZ_LIBRARIES}
    ${FREETYPE2_LIBRARIES}
    ${SQLITE_LIBRARIES}
    ${ICU_LIBRARIES}
    ${ICU_I18N_LIBRARIES}
    ${WebCore_LIBRARIES}
    ${PIXMAN_LIBRARIES}
    ${CAIRO_LIBRARIES}
    ${LIBXML2_LIBRARIES}
    ${EXPAT_LIBRARIES}
    ${ZIP_LIBRARIES}
    ${ZLIB_LIBRARIES}
    ${LZMA_LIBRARIES}
)
message("CDLauncher_LIBRARIES =${CDLauncher_LIBRARIES}")
include_directories(${CDLauncher_INCLUDE_DIRECTORIES})
add_executable(CDLauncher  ${CDLauncher_SOURCES})
add_dependencies(CDLauncher WebKit)
target_link_libraries(CDLauncher ${CDLauncher_LIBRARIES})
set_target_properties(CDLauncher PROPERTIES FOLDER "Tools")
set_target_properties(CDLauncher PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")

# Packaging
include(InstallRequiredSystemLibraries)
set(CPACK_PACKAGE_NAME CDLauncher)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "CDLauncher Package.")
#SET(CPACK_INSTALL_CMAKE_PROJECTS CDLauncher)
set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR})
set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR})
set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH})
set(CPACK_PACKAGE_VERSION "1.0")#${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")

if (WIN32)
  set(CPACK_GENERATOR ZIP)
else()
  set(CPACK_GENERATOR TGZ)
endif()

set(CPACK_STRIP_FILES TRUE)

include(CPack)

